package com.chain.qs.modules.biz.dp.handler;

import com.chain.qs.modules.biz.entity.EquipmentItemRecordTransmitterPanda1kW;
import com.chain.qs.modules.biz.service.EquipmentItemRecordTransmitterPanda1kWService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.sql.Timestamp;
import java.util.Map;

/**
 * 发射机
 */
@Component("Panda1kWTransDev")
public class Panda1kWTransDev extends AbstractDPHandler {
    @Resource
    private EquipmentItemRecordTransmitterPanda1kWService equipmentItemRecordTransmitterPanda1kWService;

    public void saveData(Map<String, Object> params) {
        EquipmentItemRecordTransmitterPanda1kW entity = new EquipmentItemRecordTransmitterPanda1kW();
        entity.setOfficeCode(officeCode);
        entity.setSgroupId(sgroupId);
        entity.setGitemId(deviceId);
        entity.setFowardPower(params.get("fo_pw") == null ? "" : params.get("fo_pw").toString());
        entity.setBackPower(params.get("ba_pw") == null ? "" : params.get("ba_pw").toString());
        entity.setFrequency(params.get("ou_le") == null ? "" : params.get("ou_le").toString());
        entity.setModelOneOutPower(params.get("m_1_ou_pw") == null ? "" : params.get("m_1_ou_pw").toString());
        entity.setModelOneReflectOutPower(params.get("m_1_ref_pw") == null ? "" : params.get("m_1_ref_pw").toString());
        entity.setModelOneAllCurrent(params.get("m_1_all_ct") == null ? "" : params.get("m_1_all_ct").toString());
        entity.setModelOneLocationOneTemp(params.get("m_1_loc_1_tep") == null ? "" : params.get("m_1_loc_1_tep").toString());
        entity.setModelOneLocationTwoTemp(params.get("m_1_loc_2_tep") == null ? "" : params.get("m_1_loc_2_tep").toString());
        entity.setModelOnePromoteCurrent(params.get("m_1_pro_ct") == null ? "" : params.get("m_1_pro_ct").toString());
        entity.setModelOneVol(params.get("m_1_vol") == null ? "" : params.get("m_1_vol").toString());
        entity.setModelTwoOutPower(params.get("m_2_ou_pw") == null ? "" : params.get("m_2_ou_pw").toString());
        entity.setModelTwoReflectOutPower(params.get("m_2_ref_pw") == null ? "" : params.get("m_2_ref_pw").toString());
        entity.setModelTwoAllCurrent(params.get("m_2_all_ct") == null ? "" : params.get("m_2_all_ct").toString());
        entity.setModelTwoLocationOneTemp(params.get("m_2_loc_1_tep") == null ? "" : params.get("m_2_loc_1_tep").toString());
        entity.setModelTwoLocationTwoTemp(params.get("m_2_loc_2_tep") == null ? "" : params.get("m_2_loc_2_tep").toString());
        entity.setModelTwoPromoteCurrent(params.get("m_2_pro_ct") == null ? "" : params.get("m_2_pro_ct").toString());
        entity.setModelTwoVol(params.get("m_2_vol") == null ? "" : params.get("m_2_vol").toString());
        entity.setModelThreeOutPower(params.get("m_3_ou_pw") == null ? "" : params.get("m_3_ou_pw").toString());
        entity.setModelThreeReflectOutPower(params.get("m_3_ref_pw") == null ? "" : params.get("m_3_ref_pw").toString());
        entity.setModelThreeAllCurrent(params.get("m_3_all_ct") == null ? "" : params.get("m_3_all_ct").toString());
        entity.setModelThreeLocationOneTemp(params.get("m_3_loc_1_tep") == null ? "" : params.get("m_3_loc_1_tep").toString());
        entity.setModelThreeLocationTwoTemp(params.get("m_3_loc_2_tep") == null ? "" : params.get("m_3_loc_2_tep").toString());
        entity.setModelThreePromoteCurrent(params.get("m_3_pro_ct") == null ? "" : params.get("m_3_pro_ct").toString());
        entity.setModelThreeVol(params.get("m_3_vol") == null ? "" : params.get("m_3_vol").toString());

        entity.setTimeStamp(new Timestamp(System.currentTimeMillis()));
        equipmentItemRecordTransmitterPanda1kWService.save(entity);
    }
}
